package yangcheng.person;

public class main {
     public static void main(String[] args) {
        Robot robot=new Robot("G7",18);
        Human human=new Human("22");
        Pig pig=new Pig("肉色");

        //Robot
        System.out.println("机器人的编号是: "+robot.getId() );
        System.out.println("机器人的额定电流是: "+robot.getCurrent());
        robot.work();
        robot.eat();
        robot.sleep();
        robot.charge();
         System.out.println();

        //Human
         System.out.println("这个人叫"+human.getName());
         human.work();
         human.eat();
         human.sleep();
         System.out.println();

         //Pig
         System.out.println("这只猪的颜色是: "+pig.getColor());
         pig.eat();
         pig.sleep();
    }
}

class  Robot implements Action{
    double current;
    String id;

    public Robot() {
    }
    public Robot(String id, double current) {
        this.id = id;
        this.current = current;
    }

    public void setId(String id) {
        this.id = id;
    }
    public void setCurrent(double current) {
        this.current = current;
    }
    public String getId() {
        return id;
    }
    public double getCurrent() {
        return current;
    }

    @Override
    public void work() {
        System.out.println("机器人开始工作");
    }
    public void eat() {
        System.out.println("机器人开机充电");
    }
    public void sleep() {
        System.out.println("机器人关机");
    }
    public void charge() {
        System.out.println("机器人关机充电");
    }
}

class Human implements Action{
    public String name;

    public Human() {
    }
    public Human(String name) {
        this.name = name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public String getName() {
        return name;
    }

    @Override
    public void work() {
        System.out.println("开始工作");
    }
    public void eat() {
        System.out.println("开始吃饭");
    }
    public void sleep() {
        System.out.println("开始睡觉");
    }
    public void charge() {
        //空方法
    }
}

class Pig implements Action{
    public String color;

    public Pig() {

    }
    public Pig(String color) {
        this.color = color;
    }

    public void setColor(String color) {
        this.color = color;
    }
    public String getColor() {
        return color;
    }

    @Override
    public void work() {
        //空方法
    }
    public void eat() {
        System.out.println("猪开始吃饭");
    }
    public void sleep() {
        System.out.println("猪开始睡觉");
    }
    public void charge() {
        //空方法
    }
}